﻿var s = document.createElement("script");
s.type = "text/javascript";
s.src = "./opentip-jquery.min.js";
$("head").append(s);
$("[data-ot]").each(function () {
    var value = $(this).attr("data-ot");
    var label = value.match(/l=(.*?);/i)[1];
    var values = JSON.parse(value.match(/v=(.*)/i)[1].replace(/'/g, "\""));

    if (label === null || label.length < 1) {
        var group = $(this).attr('g');
        var element = $("text[g=" + group + "]").first();
        if (element !== null) {
            label = "<b>" + $(element).text() + "</b><br />";
        }
    }
    else if (label !== " ") {
        label = "<b>" + label + "</b><br />";
    }

    var result = label;
    if (values instanceof Array) {
        for (i = 0; i < values.length; i++) {
            if (labels[i]) {
                result += labels[i] + ": ";
            }
            result += "<b>" + values[i] + "</b>" + "<br />";
        }
    }
    else if (values instanceof Object) {
        var i = 0;
        for (var key in values) {
            i++;
            if (labels[i]) {
                result += labels[i] + ": ";
            }
            result += key + ": <b>" + values[key] + "</b>" + "<br />";
        }
    }
        
    result = result.substring(0, result.length - 6);
    $(this).attr("data-ot", result)
            .attr("data-ot-group", "one");
});

while (null === Opentip) ;
Opentip.styles.glassstyle = {
    containInViewport: true,
    borderWidth: 2,
    borderColor: "#a7c1c5",
    background: "#EFF7F0",
    tipJoint: "bottom left",
    targetJoint: "bottom left",
    hideOn: "mouseout",
    removeElementsOnHide: true,
    hideTriggers: ["tip", "trigger"],
    fixed: true,
    hideDelay: 0,
    hideEffectDuration: 0,
    showEffectDuration: 0,
};
Opentip.defaultStyle = "glassstyle";